import Vue from 'vue'
import App from './App.vue'
import uView from "uview-ui";
import storage, { Storage } from '@/utils/storage';
import { setStore, SettingStore } from '@/store/modules/setting.ts';
import Pubsub from '@/utils/pubsub.ts';
import { shopSetStore, ShopSet } from '@/store/modules/shopset.ts'
import { userStore, UserStore } from '@/store/modules/user.ts'
import { global, Popup, setData } from '@/utils/helper';
import store from '@/store';
import { messageStore, MessageStore } from '@/store/modules/message'
Vue.prototype.$Popup = new Popup();
Vue.prototype.$global = new global()
Vue.prototype.$Pubsub = new Pubsub()
Vue.prototype.setData = setData;
Vue.prototype.$STORE = {
    setStore,
    shopSetStore,
    userStore,
    messageStore
}

export interface RootState {
    messageStore: MessageStore
    setStore: SettingStore
    userStore: UserStore
    shopSetStore: ShopSet
}


Vue.use(uView);

Vue.config.productionTip = false

new App({
    store
}).$mount()

declare module 'vue/types/vue' {
    interface Vue {
        $global: global
        $Pubsub: Pubsub
        $Popup: Popup
        $storage: Storage
        setData: (obj: { [x: string]: any }, callback?: () => void) => void
        $STORE: RootState
    }
}
